********************************************************************************
** 	TITLE: e11_chromebook_descriptive.do
**
**	PROJECT: IGNITE
** 
**  PURPOSE: Appendix Figure XI: Chromebook Usage by Floor
**
********************************************************************************
set sortseed 13

//Use Chromebook Logins dataset
use "$output_data/mt_morris_chromebooks_login.dta", clear

local t1 = clock("6:00 AM", "hm") 
local t2 = clock("9:00 AM", "hm")
local t3 = clock("12:00 PM", "hm")
local t4 = clock("3:00 PM", "hm")
local t5 = clock("6:00 PM", "hm")

local sch_3rd floor==3&( ///
	(login_time>=clock("8:00 AM", "hm")&login_time<=clock("9:00 AM", "hm"))| ///
	(login_time>=clock("11:00 AM", "hm")&login_time<=clock("12:00 PM", "hm")) ///
	)

local sch_4th floor==4&( ///
	(login_time>=clock("10:00 AM", "hm")&login_time<=clock("11:00 AM", "hm"))| ///
	(login_time>=clock("3:00 PM", "hm")&login_time<=clock("4:00 PM", "hm")) ///
	)

local sch_5th floor==5&( ///
	(login_time>=clock("9:00 AM", "hm")&login_time<=clock("10:00 AM", "hm"))| ///
	(login_time>=clock("1:00 PM", "hm")&login_time<=clock("2:00 PM", "hm")) ///
	)

local sch_3rd1 floor==3&( ///
	(login_time>=clock("9:00 AM", "hm")&login_time<=clock("10:00 AM", "hm"))| ///
	(login_time>=clock("12:00 PM", "hm")&login_time<=clock("1:00 PM", "hm")) ///
	)

local sch_4th1 floor==4&( ///
	(login_time>=clock("11:00 AM", "hm")&login_time<=clock("12:00 PM", "hm"))| ///
	(login_time>=clock("4:00 PM", "hm")&login_time<=clock("5:00 PM", "hm")) ///
	)

local sch_5th1 floor==5&( ///
	(login_time>=clock("10:00 AM", "hm")&login_time<=clock("11:00 AM", "hm"))| ///
	(login_time>=clock("2:00 PM", "hm")&login_time<=clock("3:00 PM", "hm")) ///
	)
	
	
tw (hist login_time if login_time>=clock("6:00 AM", "hm")&login_time<=clock("6:00 PM", "hm") ///
	& !(`sch_3rd'|`sch_4th'|`sch_5th') ///
	, freq by(floor,  note("")) width(3600000)) ///
	(hist login_time if `sch_3rd'|`sch_4th'|`sch_5th' ///
	, freq by(floor, note("")) width(3600000) fc(orange) lc(orange) ) ///
	(hist login_time if `sch_3rd1'|`sch_4th1'|`sch_5th1' ///
	, freq by(floor, ix note("") cols(3)) width(3600000) fc(green) lc(green) ) ///
		, xlab(`t1' "6 AM" `t2' "9 AM" `t3' "12 PM" ///
		`t4' "3 PM" `t5' "6 PM" , labsize(*.7))  ///
		xtitle("Login Time", size(*.8)) ytitle(, size(*.8)) ///
		legend(order(2 "On-IGNITE Hours" 1 "Off-IGNITE Hours" ///
		3 "One Hour after IGNITE") size(*.8)) ///
		ytitle("Number of Login Activities")
		
		
gr export "$figures/chromebook_schedule.pdf", replace

